package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.mffl.Vo.MfflLawyerCommentVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflLawyerComment;

@Mapper
public interface MfflLawyerCommentDao {

    @Select("select * from mffl_lawyer_comment t where t.id = #{id}")
    MfflLawyerComment getById(Long id);

    @Delete("delete from mffl_lawyer_comment where id = #{id}")
    int delete(Long id);

    int update(MfflLawyerComment mfflLawyerComment);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_lawyer_comment(rank, content, lawyer_id, user_id, type, createTIme, updateTime) values(#{rank}, #{content}, #{lawyerId}, #{userId}, #{type}, now() , now())")
    int save(MfflLawyerComment mfflLawyerComment);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflLawyerComment> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);



    List<MfflLawyerCommentVo> getLawyerCommentVoListByLawyerId(@Param("lawyerId") Integer lawyerId);
    List<MfflLawyerCommentVo> getLawyerCommentListByLawyerIdLimit2(@Param("lawyerId") Integer lawyerId);

    List<MfflLawyerComment> getLawyerCommentListByLawyerId(@Param("lawyerId") Integer lawyerId);

    int getRankCount(@Param("lawyerId") Integer lawyerId);
}
